package foop14bsp1.gui;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

public class ServerInfoFrame extends JFrame {
    
	private static final long serialVersionUID = -2093434830951613263L;
	
	private JTextArea tracker;
	private Integer[] playerNumbers = {1, 2, 3, 4};

    public ServerInfoFrame() {
    	
        //make sure the program exits when the frame closes
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setTitle("Mouse Server Frame");
        setSize(500,300);
        setLocationRelativeTo(null);
        
        //Using JTextArea to show status
        tracker = new JTextArea();
        add(tracker);
        setVisible(true);     
    }
    
    public void log(String text) {
    	tracker.append(text + "\n");
    }
    
    public int getPlayerNumber() {
    	return (int) JOptionPane.showInputDialog(this, "How many players:"
                , "Choose the number of players", JOptionPane.QUESTION_MESSAGE
                , null, playerNumbers, playerNumbers[0]); 
    }
}